import { adminUrl } from "@/utils/baseUrl.js";
import request from "@/utils/request";

// 创建教材分类
export function createTextbookType(data) {
  return request({
    url: adminUrl + "/collegebase/textbook-type/create",
    method: "post",
    data: data,
  });
}

// 更新教材分类
export function updateTextbookType(data) {
  return request({
    url: adminUrl + "/collegebase/textbook-type/update",
    method: "put",
    data: data,
  });
}

// 删除教材分类
export function deleteTextbookType(id) {
  return request({
    url: adminUrl + "/collegebase/textbook-type/delete?id=" + id,
    method: "delete",
  });
}

// 获得教材分类
export function getTextbookType(id) {
  return request({
    url: adminUrl + "/collegebase/textbook-type/get?id=" + id,
    method: "get",
  });
}

// 获得教材分类分页
export function getTextbookTypePage(query) {
  return request({
    url: adminUrl + "/collegebase/textbook-type/page",
    method: "get",
    params: query,
  });
}

// 获得新的教材分类分页
export function getTextbookTypeTreePage(query) {
  return request({
    url: adminUrl + "/collegebase/textbook-type/tree/page",
    method: "get",
    params: query,
  });
}
// 导出教材分类 Excel
export function exportTextbookTypeExcel(query) {
  return request({
    url: adminUrl + "/collegebase/textbook-type/export-excel",
    method: "get",
    params: query,
    responseType: "blob",
  });
}
